package main

import "fmt"

func myFunc(args interface{}) {

	fmt.Println("myFunc is called")
	fmt.Println(args)

	//判断类型 interface{} 提供了类型断言
	value, ok := args.(string)
	if !ok {
		fmt.Println("arg is not string type")
	} else {
		fmt.Println("arg is string type, value=", value)
	}
}

// any其实就是interface{}
func myFunc2(args any) {

	fmt.Println("myFunc is called")
	fmt.Println(args)

}

type Book struct {
	auth string
}

func main() {
	book := Book{auth: "zhangsan"}
	myFunc(book)
	myFunc("ouguangji")
	myFunc(13)
}
